package com.commpany.servie.basic.promotion.converter;

import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Field;
import com.commpany.servie.basic.promotion.model.dto.productpromotionmap.ProductPromotionMapDTO;
import com.commpany.servie.basic.promotion.po.ProductPromotionMapPO;

/**
 * DTO和PO相互转换工具类
 * 
 * @author test
 * @date 2020-01-02 17:36:47
 */
public class ProductPromotionMapConverter {
	
	public static ProductPromotionMapDTO toDTO(ProductPromotionMapPO src) {
	if(src==null) return null;
		ProductPromotionMapDTO  tar = new ProductPromotionMapDTO();
		tar.setId(src.getId());
		tar.setProductId(src.getProductId());
		tar.setPromotionId(src.getPromotionId());
		return tar;
	}

	public static ProductPromotionMapPO toPO(ProductPromotionMapDTO src) {
	if(src==null) return null;
		ProductPromotionMapPO  tar = new ProductPromotionMapPO();
		tar.setId(src.getId());
		tar.setProductId(src.getProductId());
		tar.setPromotionId(src.getPromotionId());
		return tar;
	}

	public static List<ProductPromotionMapDTO> toDTO(List<ProductPromotionMapPO> srcs) {
		if (srcs == null)
			return null;
		List<ProductPromotionMapDTO> list = new ArrayList<ProductPromotionMapDTO>();
		for (ProductPromotionMapPO src : srcs) {
			list.add(toDTO(src));
		}
		return list;
	}

	public static List<ProductPromotionMapPO> toPO(List<ProductPromotionMapDTO> srcs) {
		if (srcs == null)
			return null;
		List<ProductPromotionMapPO> list = new ArrayList<ProductPromotionMapPO>();
		for (ProductPromotionMapDTO src : srcs) {
			list.add(toPO(src));
		}
		return list;
	}
}
	